/**
 * @copyright 2015 Indie Semiconductor.
 *
 * This file is proprietary to Indie Semiconductor.
 * All rights reserved. Reproduction or distribution, in whole
 * or in part, is forbidden except by express written permission
 * of Indie Semiconductor.
 *
 * @file lin_types.h
 */

#include "orion.h"

#ifndef __LIN_TYPES_H__
#define __LINS_SFRS_H__

#define E_LIN_STATUS_COMPLETE       (1 << 0)
#define E_LIN_STATUS_WAKEUP         (1 << 1)
#define E_LIN_STATUS_ERROR          (1 << 2)
#define E_LIN_STATUS_INT_REQ        (1 << 3)
#define E_LIN_STATUS_DATA_REQ       (1 << 4)
#define E_LIN_STATUS_ABORT          (1 << 5)
#define E_LIN_STATUS_IDLE_TIMEOUT   (1 << 6)
#define E_LIN_STATUS_ACTIVE         (1 << 7)

#define E_LIN_ERROR_BIT             (1 << 0)
#define E_LIN_ERROR_CHECKSUM        (1 << 1)
#define E_LIN_ERROR_TIMEOUT         (1 << 2)
#define E_LIN_ERROR_PARITY          (1 << 3)

#define E_LIN_TIME_INACTIVE_SEC_4       0
#define E_LIN_TIME_INACTIVE_SEC_6       1
#define E_LIN_TIME_INACTIVE_SEC_8       2
#define E_LIN_TIME_INACTIVE_SEC_10      3
#define E_LIN_TIME_INACTIVE_MAX         E_LIN_TIME_INACTIVE_SEC_10

#define E_LIN_TIME_WAKEUP_REPEAT_MS_180 0
#define E_LIN_TIME_WAKEUP_REPEAT_MS_200 1
#define E_LIN_TIME_WAKEUP_REPEAT_MS_220 2
#define E_LIN_TIME_WAKEUP_REPEAT_MS_240 3
#define E_LIN_TIME_WAKEUP_REPEAT_MAX    E_LIN_TIME_WAKEUP_REPEAT_MS_240

#define E_LIN_BAUDRATE_1000     0
#define E_LIN_BAUDRATE_9600     1
#define E_LIN_BAUDRATE_19200    2
#define E_LIN_BAUDRATE_MAX      E_LIN_BAUDRATE_19200

#define E_LIN_MODE_SLAVE        0
#define E_LIN_MODE_MASTER       1
#define E_LIN_MODE_MAX          E_LIN_MODE_MASTER

#define E_LIN_CHKSUM_CLASSIC    0
#define E_LIN_CHKSUM_ENHANCED   1

#define E_LIN_POLARITY_HIGH     0
#define E_LIN_POLARITY_LOW      1

#define E_LIN_DATA_BUFFER_LENGTH    8

#endif /* __LINS_SFRS_H__ */
